<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/StaffTemplate.xhtml">

    <ui:define name="nav_menu">
        <p:menubar model="#{staffChangeInitialPasswordManagedBean.staffMenuModel}"/>
    </ui:define>
    <ui:define name="content">
        <h:form>
            <h1>View point accumulations in a specified period of time</h1>         
            <p:fieldset>
                <h:outputText value="Specify the period of time : " />
                <h:panelGrid id="display" columns="2" cellpadding="5">  
                    <h:outputText value="From : " />  
                    <p:calendar value="#{tCubeULPManagerBean.inputDateFrom}" />   
                    <h:outputText value="Until : " />  
                    <p:calendar value="#{tCubeULPManagerBean.inputDateUntil}" />
                    <p:commandButton value="View" actionListener="#{tCubeULPManagerBean.retrieveAccumulationInPeriodList}" />
                    <p:commandButton value="View All Redemptions" actionListener="#{tCubeULPManagerBean.retrieveAllAccumulationList}" />
                </h:panelGrid>         
            </p:fieldset>
            <br/>
            <br/>

            <p:panel header="View Point Accumulations">
                <p:accordionPanel autoHeight="false">
                    <p:tab title="Point Accumulations (Double click to select)">
                        <p:dataTable var="accumulation" value="#{tCubeULPManagerBean.accumulationList}" paginator="true" 
                                     rows="10" emptyMessage="No accumulation recorded" selection="#{tCubeULPManagerBean.selectedAccumulation}" 
                                     selectionMode="single" rowSelectListener="#{tCubeULPManagerBean.onRowSelectNavigateViewAccumulation}"
                                     dblClickSelect="true">
                            <p:column sortBy="#{accumulation.reservation.id}" filterBy="#{accumulation.reservation.id}">
                                <f:facet name="header">
                                    <h:outputText value="ID" />
                                </f:facet>
                                <h:outputText value="#{accumulation.reservation.id}" />
                            </p:column>

                            <p:column sortBy="#{accumulation.reservation.branch.stakeholder.corpName}" filterBy="#{accumulation.reservation.branch.stakeholder.corpName}">
                                <f:facet name="header">
                                    <h:outputText value="Reservation with" />
                                </f:facet>
                                <h:outputText value="#{accumulation.reservation.branch.stakeholder.corpName}" />
                            </p:column>

                            <p:column sortBy="#{accumulation.reservationDate}" filterBy="#{accumulation.reservationDate}">
                                <f:facet name="header">
                                    <h:outputText value="Reservation Date" />
                                </f:facet>
                                <h:outputText value="#{accumulation.reservationDate}">
                                    <f:convertDateTime dateStyle="full" pattern="EEE, dd/MM/yyyy" timeZone="EST" type="date" />
                                </h:outputText>
                            </p:column>

                            <p:column sortBy="#{accumulation.totalBill}" filterBy="#{accumulation.totalBill}">
                                <f:facet name="header">
                                    <h:outputText value="Total Bill Value" />
                                </f:facet>
                                <h:outputText value="#{accumulation.totalBill} SGD" />
                            </p:column>

                            <p:column sortBy="#{accumulation.totalPoint}" filterBy="#{accumulation.totalPoint}">
                                <f:facet name="header">
                                    <h:outputText value="Points Received" />
                                </f:facet>
                                <h:outputText value="#{accumulation.totalPoint} points" />
                            </p:column>                 

                        </p:dataTable>
                    </p:tab>
                </p:accordionPanel>
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>